
<% lineconst = 3 -%>
<% linenum = smallcommlist.size/lineconst -%>
<% leftnum = smallcommlist.size%lineconst -%>
<table>
<% for i in 0...linenum -%>
     <tr>
     <% for j in 0...lineconst -%>
       <td>
       <%= link_to "#{smallcommlist[i*lineconst+j].title}", community_path(smallcommlist[i*lineconst+j].district, smallcommlist[i*lineconst+j]) %>
       </td>
     <% end -%>
     </tr>
<% end -%>
<% if leftnum > 0 -%>
  <tr>
  <% for i in 0...leftnum -%>
    <td>
    <%= link_to "#{smallcommlist[linenum*lineconst+i].title}", community_path(smallcommlist[linenum*lineconst+i].district, smallcommlist[linenum*lineconst+i]) %>
    </td>
  <% end -%>
  <% for i in 0...(lineconst-leftnum) -%>
    <td>
    &nbsp;
    </td>
  <% end -%>
  </tr>
<% end -%>
</table>
<% if @communities.size > 0 -%>
<%= will_paginate_remote @communities, :class => 'small_pagination', :url => {:controller => "districts", :action => "ajaxsmallshowcomm", :id => smallcommlist[0].district}, :loading => "Element.hide('communities_div'), Element.show('loading-gif')", :complete => "Element.show('communities_div'), Element.hide('loading-gif')", :update=>"communities_div" %>
<% end -%>